EECE 4353 Image Processing Vanderbilt University School of Engineering EECE/CS 4353 Image Processing

Lecture Notes: Histogram Point Processing of Images

Richard Alan Peters II

Department of Electrical Engineering and Computer Science

Fall Semester 2018

EC This work is licensed under the Creative Commons Attribution-Nonc mmercial 2.5L copy of this lic isit http://creativecommons.org/licenses/by-nc/2.5/ or end a letter to Cre ative Commons, 543 Howa PON a r, San m PUMA s USA.

EECE 4353 Image Processing Vanderbilt University School of Engineering Point Processes: Histogram Equalization

Task: remap a 1-band image I so that its histogram 1s as close to constant as possible. This maximizes the contrast evenly across the entire intensity range.

Let P(y+1) be the cumulative (probability) distribution function of I. Then J has, as closely as possible, a flat (constant) histogram 1f:

J(r,c,b) = 255- P| I(r,c,b)+1 |. ‘one-band The scaled CDF itself is used as the LUT. image That is, to equalize a one-band image, map it through its own CDF

multiplied by the maximum desired output value.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 2

EECE 4353 Image Processing Vanderbilt University School of Engineering Point Processes: Histogram Equalization

Task: remap image I with min = m, and max = M, so that its histogram is as close to constant as possible and has min = m; and max = M}.

Let P(y+1) be the cumulative (probability) distribution function of I.

Then J has, as closely as possible, the correct histogram 1f

Using ALAr.c) +1 |- Him +1 intensity | J(r.c) - (M, d extrema BE 2

+ m.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 3

EECE 4353 Image Processing Vanderbilt University School of Engineering

The CDF (cumulative distribution) Histogram EQ x 255 is the LUT for remapping.

Av mee -— See ee t qa E aaa WM

DRA! vu Masi: n 39 0s ^ Lr

A es oor S = ^t = "

Histogram EQ'd Value Image

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 4

EECE 4353 Image Processing Vanderbilt University School of Engineering

The CDF (cumulative distribution) Histogram EQ x 255 is the LUT for remapping.

QO SS ae (_.- —_— oe v '

Aa ah vu Masi: n 39 0s ^ Lr

A es oor S = ^t = "

Histogram EQ'd Value Image

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 5

EECE 4353 Image Processing Vanderbilt University School of Engineering

The CDF (cumulative distribution) Histogram EQ x 255 is the LUT for remapping.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 6

ue Wes. oe Histogram EQ'd Value Image

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Histogram EQ

Luminance Histogram of Original Image

ae ` rl udi Ao E d D^ A ien .-— mn n il

> TY 2 M

100 150

Luminance Histogram of Equalized Image

0 50 100 150

200

x =" _ TV aa ae m. Histogram EQ'd Value Image

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 7

Once again, but bigger EECE 4353 Image Processing (and with more feeling!)

Vanderbilt University School of Engineering

Histogram EQ of a Grayscale Image

x 10* Luminance Histogram of Kinkaku-ji

i

0 50 100 150 200 250

Luminance Image Luminance Histogram

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 8

NE EECE 4353 Image Processing (and with more feeling!) Vanderbilt University School of Engineering

Histogram EQ of a Grayscale Image

Luminance CDF of Kinkaku-ji

0 50 100 150 200 250

Luminance Image Luminance CDF

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 9

NE EECE 4353 Image Processing (and with more feeling!) Vanderbilt University School of Engineering

Histogram EQ of a Grayscale Image

LUT for Luminance Equalization of Kinkaku-ji 250

200 150

100

0 100 150 200 250

Luminance Image Equalization LU T

11 September 2018 (c) 1999-2018 by Richard Alan Peters II

Once again, but bigger EECE 4353 Image Processing (and with more feeling!)

Vanderbilt University School of Engineering

Histogram EQ of a Grayscale Image

x 10* Histogram of Equalized Kinkaku-ji Luminance image

0 0

Equalized Luminance Image Histogram of Eqd Image

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 11

Once again, but bigger EECE 4353 Image Processing (and with more feeling!)

Vanderbilt University School of Engineering

Histogram EQ of a Grayscale Image

Luminance Image Equalized Luminance Image

Note the detail loss in saturated areas.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 12

V One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Histogram EQ of Individual Color Bands

Histograms of Kinkaku-ji Color Bands

Original Color Image Color Histograms

Here we will create a separate equalization LUT for each of the color bands from each of their CDFs.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 13

V One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Histogram EQ of Individual Color Bands

CDFs of Kinkaku-ji Color Bands

0 50 100 150 200 250

Original Color Image Color CDFs

Here we will create a separate equalization LUT for each of the color bands from each of their CDFs.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 14

V One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Histogram EQ of Individual Color Bands

LUT for Color Equalization of Kinkaku-ji

0 50 100 150 200 250

Original Color Image Equalization LUTs

These are the separate equalization LUTs one for each of the color bands.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 15

V One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Histogram EQ of Individual Color Bands

x 10* Histogram of Color Equalized Kinkaku-ji

Equalized Color Image m of Eq‘ d P

This 1s the result of mapping each band through its own equalization LUT. Notice how the hues have changed in some parts of the image.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 16

One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Original Color Image Equalized Color Image

This 1s the result of mapping each band through its own equalization LUT. Notice how the hues have changed in some parts of the image.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 17

One CDF-based EECE 4353 Image Processing LUT for each band Vanderbilt University School of Engineering

Equalized Color Image Original Color Image

This 1s the result of mapping each band through its own equalization LUT. Notice how the hues have changed in some parts of the image.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 18

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

Histograms of Kinkaku-ji Color Bands

Original Color Image Color Histograms

Here we compute the CDF of the luminance or value image, make a LUT from it, then remap all three color bands through the same LUT.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 19

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

Luminance Image

Here we compute the CDF of the luminance or value image, make a LUT from it, then remap all three color bands through the same LUT.

x 10° Luminance Histogram of Kinkaku-ji

0 50 100 150 200 250

Luminance Histogram

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 20

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

CDFs of Kinkaku-ji Color Bands

0 50 100 150 200 250

Original Color Image Color CDFs

Here we compute the CDF of the luminance or value image, make a LUT from it, then remap all three color bands through the same LUT.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 21

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

Luminance CDF of Kinkaku-ji

0 50 100 150 200 250

Luminance Image Luminance CDF

Here we compute the CDF of the luminance or value image, make a LUT from it, then remap all three color bands through the same LUT.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 22

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

LUT for Luminance Equalization of Kinkaku-ji

0 100 150 200 250

Original Color Image Equalization LUT

Here we compute the CDF of the luminance or value image, make a LUT from it, then remap all three color bands through the same LUT.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 23

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

Luminance Eq'd Color Image Original Color Image

This is what we get when we map each of the three bands through the LUT created from the CDF of the image’s luminance.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 24

EECE 4353 Image Processing Vanderbilt University School of Engineering

Histogram EQ of the Individual Bands

I ]

EL ee ee Oe BELEEELELICUIN

uJ

Lj

Each band EQ'd Separately Luminance EQ'd Color Image

The left image is what we got when we equalized each of the three bands separately. The right image 1s what we get when we map each color band through the luminance CDF

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 29

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance EQ of a Color Image

s » m 6 l À v. = wr" » r , E 7 " » = A é s = a ya a o N Pol T." a F 4. = (i = 74 = aT

Original Color Image Each band EQ'd Separately

Remapping each of the color bands through the luminance CDF LUT preserves the hues of the original image better than the individual equalization of each color band.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 26

11 September 2018

EECE 4353 Image Processing Vanderbilt University School of Engineering

Point Processing: Histogram Matching

(c) 1999-2018 by Richard Alan Peters II 21

EECE 4353 Image Processing Vanderbilt University School of Engineering Point Processing: Histogram Matching

Task: Remap image I, (discolored) so that it has, as closely as possible, the same histogram as image J, (reference).

Q: Why do this?

A: Restore a degraded image based on an original. Match the characteristics of 1mages of the same scene from different cameras.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 28

EECE 4353 Image Processing Vanderbilt University School of Engineering Point Processing: Histogram Matching

Task: Remap image I, (discolored) so that it has, as closely as possible, the same histogram as image J, (reference).

Because the images are digital 1t 1s not, 1n general, possible to make h, = A.. Therefore, p, £ p, .

Q: How, then, can the matching be done? A: By matching percentiles.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 29

V d: discolored EECE 4353 Image Processing r: reference | Vanderbilt University School of Engineering

.. assuming a 1-band image,

Matching Percentiles one band of a color image

or its luminance image. Recall:

e CDF P, of image I, 1s such that 0 P4( g4) S I.

e P,( g4t1) =c means that c 1s the fraction of pixels in I, that have a value less than or equal to g,.

* 100c 1s the percentile of pixels 1n I, that are less than or equal tO Zy.

To match percentiles, replace all occurrences of value g, in image I, with value g, from image J, whose percentile in J. most closely matches the percentile of g} in image I,.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 30

d: discolored EECE 4353 Image Processing

Hr reference Vanderbilt University School of Engineering

.. assuming a 1-band image,

Matching Percentiles one band of a color image

or its luminance image.

So, to create an image, K, from image I, such that K

has nearly the same CDF as image J, do the following:

Example: | Ae) = S P. (5) = 0.65 P. (9) = 0.56 P. (10) = 0.67 K(rc)- 10

If L(zc) = g; then let K(nc) = g, where g, is such that

Pa (Za) > P.(g,-1) AND Pa (Za) < P. (gy).

^a 10 ~ 1.0 | | s 08 08 iN a A "m 0.6 0.6 04 04 02 | 02 0.0 0.0 : 0123 4 |5 |6 7 8 9 101112131415 g; 012345678 9 101111213 14 15 gj

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 31

V d: discolored EECE 4353 Image Processing r: reference Vanderbilt University School of Engineering .. assuming a 1-band image,

Histogram Matching Algorithm one band of a color image Se

[R,C] =size (Ij) ; This directly matches K= zeros (R,C) ; image I, to image J..

g, = Mm, for g, = m, to M, P (g, +1) : CDF of L, while 2,«255 AND P,(g,*1)«1 AND

P (g, 1) : CDF of J}.

min J, P (g, *1) « P (ga 1) u ; = max

Tl; r r?

uu m = minl,

iii M,= max l.

K=K+ ZW E

end L | s.) Maybe faster to use a LUT. See slide 74.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 92

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Example: Histogram Matching

"Discolored" Image with 16 intensity 0.30 values.

Discolored Image pdf

Image 0.25 probability density function,

pdf.

0.10

0.05 | Wp 0.00

0123450678 Ais... g

IJ $1919q URTV preyory Aq 1912?) ooedgs uosuyor VSVN W leg POY :oSeui

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 33

EECE 4353 Image Processing Vanderbilt University School of Engineering

Example: Histogram Matching

Discolored Image CDF C 1.0 Image

=

E

O

Probability Distribution 0.8 m 0.6 0.4 0.2 0.0 |

01234567 8 9101112131415 S

II $1939q ue[y pueuorg Aq 193uo?) ooedg uosuyos VSVN W Med 19»[oos] :ogeui

*a.k.a Cumulative Distribution Function, CDF}.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 34

V EECE 4353 Image Processing Vanderbilt University School of Engineering

Example: Histogram Matching

Reference Reference Image pdf ima ge with 16 intensity te) 0.15 [^ Target values. so probability density function, C 0.12 + pdf;

Target a.k.a. Reference

0.09

0.06 |

0.03 | | 0.00 -

01234567289101112131415 g

/di[o-s1osnod-Su0JA /310A/u100 ueUIDpIe? MMM //:sdyy *c66] t'uoneuruv ueumpieV. ‘Weg YIN Å SIONO, FUOM ou, WOI [[Hs uoronpoujg :oSeuiq

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 35

V EECE 4353 Image Processing Vanderbilt University School of Engineering

Example: Histogram Matching

"o MT L^.

Reference Image CDF Rs is Target a Ha Probability Distribution Function, $ 0.8 - PDF,”

Target a.k.a. Reference

: 0.4 - i | 0.0 n £

01234567 89101112131415 g P Te

DA almi.

*a.k.a Cumulative Distribution Function, CDF).

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 36

EECE 4353 Image Processing Vanderbilt University School of Engineering Histogram Matching with a Lookup Table

The algorithm on slide 69 matches one image to another directly. Often it is faster or more versatile to use a lookup table (LUT). Rather than remapping each pixel in the image separately, one can create a table that indicates to which target value each input value should be mapped. Then

K = LUT[I, + 1]

In Matlab 1f the LUT 1s a 256 x | matrix with values from 0 to 255 and 1f image I, is one or multi-band of type uint8, it can

be remapped with the following code:

K = uint8(LUT(I-1));

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 37

EECE 4353 Image Processing Vanderbilt University School of Engineering Histogram Matching with a Lookup Table

The E-Z teenage New York version" on the previous page only works for one-band images. For truecolor or other multiband images you need to execute the LUT on each band separately. Viz:

if E == % single band LUT; multi-band image for b = 1:B J(:,:,b) = LUT(1+double(I(:,:,b)));

Not true now! In : Nevertheless, I still Matlab 2018 e d d K : uintB(LU TE D) se % multiband LUT; multi-band image i A M works for both 1- fo = oe Page and watch Terry

and 3-band images. DUUM c IBgHSese eer tud pg Bozzio shred it. J(:,:,b) = LUT1D(1+double(I(:,:,b)));

end end

“http://globalia.net/donlope/fz/lyrics/Zappa_|In_ New_York.html#Page and https://www.youtube.com/watch?v-AQt2inyxNNg

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 38

V l EECE 4353 Image Processing LUT Creation Vanderbilt University School of Engineering

Discolored ap “T Reference CDF 0.8 0.8 0.6 0.4 0.4 0.2 0.2 0.0 0.0 z |

0 | 2 3(4)5 6 7 8 9 1011121314 15 012345067090 9 4011 12 13 14 15

15 LUT 12

012 3@)5 6 7 8 9 1011 12 13 14 15

Me

CO

UJ

e

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 39

Vanderbilt University School of Engineering

d: discolored EECE 4353 Image Processing r: reference

Look Up Table for Histogram Matching

LUT = zeros (256,10) ; This creates a look-up

g = 0; table which can then be used to remap the image. For g, = 0 to 255 l -

while P(g.+I<P,(g,+1) AND g «255 E TRSOEL | u P,(g,*1): CDF of L,

LUT( g, *1)- g;; P(g, +1): CDF of J,, LUT ( g,t+ 1) : Look-Up Table

end

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 40

Discolored & Reference CDFs, LUT, and Resultant CDF

11 September 2018

0

2

3

4

5

6

7 8 9 101112131415 2g

7 8

9

10 1112131415 g

P(g)

P(g)

EECE 4353 Image Processing Vanderbilt University School of Engineering

Ref. |

012 a o 7 8 9 101112131415 g

Result |

012345 6 7 8 Ail

(c) 1999-2018 by Richard Alan Peters II 41

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Example: Histogram Matching

discolored reference remapped

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 42

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Probability Density Functions (pdfs)

Atlas-Mercury r, g, b, & v pdfs (densities)

red pdf green pdf

blue pdf luminosity pdf

Image: Rocket Park at NASA Johnson Space Center by Richard Alan Peters II

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 43

EECE 4353 Image Processing Vanderbilt University School of Engineering

Cumulative Distribution Functions (CDF)

11 September 2018

Atlas-Mercury r, g, b, & v PDFs (Distributions)

50 100 150 200 250 1 Lf 0 50 100 150 200 250 1 I —— ———Á— i —ÀÀ 0 50 100 150 200 250 1 bo i 50 100 150 200 250 red CDF blue CDF green CDF luminosity CDF

Image: Rocket Park at NASA Johnson Space Center by Richard Alan Peters II

(c) 1999-2018 by Richard Alan Peters II 44

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Probability Density Functions (pdfs)

TechnoTrousers r, g, b, & v pdfs (densities)

red pdf green pdf

blue pdf luminosity pdf

Image: Production still from “The Wrong Trousers," Nick Park, Aardman Animation, 1993, https://www.aardman.com/work/wrong-trousers-clip/

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 45

V

EECE 4353 Image Processing Vanderbilt University School of Engineering

Cumulative Distribution Functions (CDF)

TechnoTrousers r, g, b, & v PDFs (Distributions)

50 100 150 200 250 1 eS a Jj BED 0 50 100 150 200 250 0 50 100 150 200 250 1 0 50 100 150 200 250 red CDF blue CDF green CDF luminosity CDF

Image: Production still from “The Wrong Trousers,” Nick Park, Aardman Animation, 1993, https://www.aardman.com/work/wrong-trousers-clip/

11 September 2018

(c) 1999-2018 by Richard Alan Peters II 46

EECE 4353 Image Processing Vanderbilt University School of Engineering

Remap one Image to have the RGB CDF of Another

2)

original "discolored

target "reference" R, G, & B remapped

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 47

EECE 4353 Image Processing Vanderbilt University School of Engineering

RGB CDks and the LUTSs

Atlas-Mercury Red PDF Atlas-Mercury Green PDF Atlas-Mercury Blue PDF

1 1 i 1

05r 4 05+ ,U GS 4 n 1 T

TechnoTrousers Red PDF 250 TechnoTrousers Green PDF 250 TechnoTrousers Blue PDF 250

1 1 1 0.5} + 05+ + 05+ - LUT (Red) Atlas-Mercury to TechnoTrousers 0 LUT (Green) Atlas-Mercury to TechnoTrousers LUT (Blue) Atlas-Mercury to TechnoTrousers 0

Atlas-Mercury RGB Remapped Red PDF 250 Atlas-Mercury RGB Remapped Green PDF 9 Atlas-Mercury RGB Remapped Blue PDF 250 | OO uem | 05+ 4 05. ee j 05+ J "C pee 0 (jene (J —L ÉL. 50 100 150 200 250 50 100 150 200 250 50 100 150 200 250

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 48

VW EECE 4353 Image Processing Vanderbilt University School of Engineering

Effects of RGB Remapping on pdfs

g, b, &vpdis(densties) ë .— .— .— |^ |^ tlas-Mercury RGB Remapped pdfs (densities

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 49

WV EECE 4353 Image Processing Vanderbilt University School of Engineering

Effects of RGB Remapping on CDFs

Atlas-Mercury r, g, b, & v PDFs (Distributions) Atlas-Mercury RGB Remapped PDFs (Distributions)

1 ——— 1 0 0 E]

efore After B

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 50

EECE 4353 Image Processing Vanderbilt University School of Engineering

Remap one Image to have the Lum. CDF of Another

original "discolored" target "reference" luminosity remapped

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 5]

EECE 4353 Image Processing Vanderbilt University School of Engineering

Luminance CDFs and the LUT

Atlas-Mercury Luminosity CDF

0.5 0 90 TechnoTrousers Luminosity CDF 200 250 1 0.5 0 LUT (Luminosity) Atlas-Mercury to TechnoTrousers 250 200 100 0 50 Atlas-Mercury Remapped Luminosity CDF 200 250 1 E 0.5 0 50 100 150 200 250

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 52

VW EECE 4353 Image Processing Vanderbilt University School of Engineering

Effects of Luminance Remapping on pdfs

, 9, b, & v pdfs (densities)

100 150

“cl NEN . cutie, j

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 53

EECE 4353 Image Processing Vanderbilt University School of Engineering

Effects of Luminance Remapping on CDFs

Atlas-Mercury r, g, b, & v PDFs (Distributions)

Atlas-Mercury Value Remapped PDFs (Distributions)

50 100 150 200 250 50 100 150 200 250 1 1 0.5 0.5 NN ll 0 0 50 100 150 200 250 50 100 150 200 250 1 oS 1 0 0 50 100 150 200 250 50 100 150 200 250 1 ————— 1 SS ae . BEP 0 0 50 100 150 200 250 50 100 150 200 250 11 September 2018 (c) 1999-2018 by Richard Alan Peters II 54

EECE 4353 Image Processing Vanderbilt University School of Engineering

Histogram Equalization Revisited

Our first attempt to equalize the color version of Kinkaku-ji by mapping each band through its own CDF LUT led to the unsatisfactory results below (left):

-e

|

S- ee Yi be

55021 L n (a) Direct equalization of the color bands by (b) Equalization of the color bands by mapping mapping each band though its own CDF. each band though the CDF of the luminance LUT, = 255*CDF, image. LUT, = 255*CDF,.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 33

EECE 4353 Image Processing Vanderbilt University School of Engineering Histogram Equalization Revisited

Histogram matching presents another alternative: Match each color band CDF with the CDF from the luminance image. Then we get:

CIRS T =E

(a) Original image. (b) Equalization by mapping band, b, though LUT, = 255*[CDF,]'.*CDF,.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 56

Each color band CDF i tched

tote lonimence CbR te" | EECE 4353 Image Processing generate a LUT for each band Vanderbilt University School of Engineering

EQ by matching each color-band to image luminance

In 6 (count em) 1. Convert image I into grayscale image, L, via your 6 E-Z steps! favorite weighting scheme.

2. Compute the 3 color histograms, hc, C e {R,G,B} of I and the histogram, 7; , of L.

3. Compute the 4 probability density functions, pc, Ce {R,G,B,L}, from the he.

4. Compute the 4 cumulative distribution functions, He, Ce {R,G,B,L}, from the po.

9. Generate 3 lookup tables, Te, Ce {R,G,B}, by matching H, to H,, Ho to H,, & Hp to H}.

6. Map each image band {R,G,B! through its corresponding lookup table To.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 2d

Each color band CDF is matched . V to the luminance CDF to EECE 4353 Image Processing

generate a LUT for each band Vanderbilt University School of Engineering

EQ by matching each color-band to image luminance

x 10* Histograms of Kinkaku-ji Color Bands and Lumninance Image

Original Color Image Color & Lum. Histograms

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 58

generate a LUT for each band Vanderbilt University School of Engineering

Each color band CDF is matched . V to the luminance CDF to EECE 4353 Image Processing

EQ by matching each color-band to image luminance

CDFs of Kinkaku-ji Color Bands and Lumninance Image

0 5

Original Color Image Color & Lum. CDFs

100 150 200 250

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 59

generate a LUT for each band Vanderbilt University School of Engineering

Each color band CDF is matched . V to the luminance CDF to EECE 4353 Image Processing

EQ by matching each color-band to image luminance

Matched LUT for Luminance Remapping of Color Bands

0 100 150 200 250

Original Color Image Equalization LUT

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 60

Each color band CDF is matched . Y to the luminance CDF to EECE 4353 Image Processing

generate a LUT for each band Vanderbilt University School of Engineering

EQ by matching each color-band to image luminance

x 10* Histogram of Luminance Matched Remapped Color Bands

| TM

UN | Jj In 3c ze A ths

I | 2

| eil Luminance matched image Histo of lum matched image

Note the desaturation of the colors. |

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 61

Each band in one image is siii uo Gn nce aimee ded EECE 4353 Image Processing

in the other image.

Vanderbilt University School of Engineering

Original color image Each band eqd separately

Right image: equalized each of the three bands separately (pp. 47-52).

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 62

P y Luminance is used to generate EECE 4353 Image Processing y one LUT for all bands. Vanderbilt University School of Engineering

Method 2: Map each band through 1 luminance LUT

| _ enm- Cr as a, aa caos m n ain. n hr ».

o - a ^ - uet - s E " toT

A

a”

m.

Original color image Each band eqd through lum.

Right image: mapped each band through the LUT from luminance CDF (pp. 53-58).

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 63

Each color band CDF is matched VERAS EECE 4353 Image Processing generate a LUT for each band Vanderbilt University School of Engineering

Method 3: Match each band to luminance, 3 LUTs

Original color image Each band matched to lum.

Right image: matched each band to the luminance (pp. 90-95).

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 64

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Histogram Matching for Image Restoration

Degraded image Another image of the same scene, not degraded

Ape. SG UPA AST 7

» IM TLCLE

, Nu. Fy A £v h

Lotus Flowers at Turtle Head Park, Lake Tai, Wuxi, Jiangsu Province, China. ib TE ELA AA Zia ILAA FE. Photos by R. A .Peters ll, July 2013.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 65

V EECE 4353 Image Processing Vanderbilt University School of Engineering

Histogram Matching for Image Restoration

Histogram of Degraded Scenic Picture 2 x 10* Histogram of Scenic Picture 1 x 10* Histogram of Remapped Degraded Image T T T T T T T

MN MT "

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 66

EECE 4353 Image Processing Vanderbilt University School of Engineering

V

Histogram Matching for Image Restoration

Degraded image Another image of the same scene, not degraded

Lotus Flowers at Turtle Head Park, Lake Tai, Wuxi, Jiangsu Province, China. ib TE ELA Ail Zia ILAA FE. Photos by R. A .Peters ll, July 2013.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 67

V EECE 4353 Image Processing

Vanderbilt University School of Engineering

Histogram Matching for Image Restoration

Another image of the same scene, not degraded | Jo EOS UP EN (URS LER 1.2 - Xm

Lotus Flowers at Turtle Head Park, Lake Tai, Wuxi, Jiangsu Province, China. it TE Sia Ail Zam (ASB FE. Photos by R. A .Peters ll, July 2013.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 68

Robot's view of boxes to move. EECE 4353 Image Processing http:/ /www.universalrobotics.com/ Vanderbilt University School of Engineering

Histogram Matching for Stereo Color Correction

Left Image . Right Image

Images from a stereo pair of inexpensive web cams. Such cameras have different color characteristics of-the-shelf. Once can be corrected to match the other using histo. matching.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 69

V EECE 4353 Image Processing Vanderbilt University School of Engineering

Histogram Matching for Stereo Color Correction

x 10 g g g T : T 2.5 2 + 1.5 1 7 5 N Jl i} «me P nan 0 L ——— M —— ÀÁ— ce) 0 50 100 150 200 250

x 10° Histogram of Stereo Left Image T T

o

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 70

Robot's view of boxes to move. EECE 4353 Image Processing http:/ /www.universalrobotics.com/ Vanderbilt University School of Engineering

Histogram Matching for Stereo Color Correction

Left Image . Right Image

Images from a stereo pair of inexpensive web cams. Such cameras have different color characteristics of-the-shelf. Once can be corrected to match the other using histo. matching.

11 September 2018 (c) 1999-2018 by Richard Alan Peters II 71

EECE 4353 Image Processing

V Robot's view of boxes to move. : http://www.universalrobotics.com/ | Vanderbilt University School of Engineering

Histogram Matching for Stereo Color Correction

Right Image

Left Image

f;

m -— wt a E -—-—* d .

Right image histogram matched to left image.

12

11 September 2018 (c) 1999-2018 by Richard Alan Peters II